import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 放款信息信息 */
export interface loan {
          id: number; // ID
          customerId?: number; // 新客户id
          followUserId?: number; // 跟进用户id
          followUserName?: string; // 跟进用户名称
          loanAmount?: number; // 放款金额
          commission?: number; // 佣金
          points?: number; // 点数
          bank?: number; // 放款银行
          loanTime?: string | Dayjs; // 放款时间
          paymentCollectionTime?: string | Dayjs; // 回款时间
          signTime: string | Dayjs; // 签约时间
          signContract: string; // 签约合同
          deposit: number; // 押金
          cost: number; // 成本费
          assist: string; // 协助进件
          referral: number; // 转介绍
          review: string; // 点评
  }

// 放款信息 API
export const loanApi = {
  // 查询放款信息分页
  getloanPage: async (params: any) => {
    return await request.get({ url: `/system/loan/page`, params })
  },

  // 查询放款信息详情
  getloan: async (id: number) => {
    return await request.get({ url: `/system/loan/get?id=` + id })
  },

  // 新增放款信息
  createloan: async (data: loan) => {
    return await request.post({ url: `/system/loan/create`, data })
  },

  // 修改放款信息
  updateloan: async (data: loan) => {
    return await request.put({ url: `/system/loan/update`, data })
  },

  // 删除放款信息
  deleteloan: async (id: number) => {
    return await request.delete({ url: `/system/loan/delete?id=` + id })
  },

  /** 批量删除放款信息 */
  deleteloanList: async (ids: number[]) => {
    return await request.delete({ url: `/system/loan/delete-list?ids=${ids.join(',')}` })
  },

  // 导出放款信息 Excel
  exportloan: async (params) => {
    return await request.download({ url: `/system/loan/export-excel`, params })
  },

  /** 滚动显示放款信息 */
  getLoanList: async () => {
    return await request.get({ url: `/system/loan/list` })
  },
}